<!DOCTYPE html>
<html>
{% extends 'base.html' %}
{% load staticfiles %}

{% block title %}{{ course.name }}详情介绍{% endblock %}

{% block header %}
<nav>
				<div class="nav">
					<div class="wp">
						<ul>
							<li><a href="{% url 'index' %}">首页</a></li>
							<li class="active">
								<a href="{% url 'course:course_list' %}">
									公开课<img class="hot" src="/static/images/nav_hot.png">
								</a>
							</li>
							<li>
								<a href="{% url 'org:teacher_list' %}">授课教师</a>
							</li>
							<li ><a href="{% url 'org:org_list' %}">授课机构</a></li>
						</ul>
					</div>
				</div>
			</nav>
{% endblock %}

{% block custom_bread %}
<section>
	<div class="wp">
		<div class="crumbs">		
			<ul>
				<li><a href="/">首页</a>></li>
                <li><a href="{% url 'course:course_list' %}">公开课程</a>></li>
				<li>课程详情</li>
			</ul>
		</div>
	</div>
</section>
{% endblock %}

{% block content %}
<section>
	<div class="wp">
		<div class="groupPurchase_detail detail">
			<div class="toppro">
				<div class="left">
					<div class="picbox">
						<div class="tb-booth tb-pic">
							<img width="440" height="450" src="{{ MEDIA_URL }}{{ course.image }}"  rel="/static/images/mysql.jpg" class="jqzoom" />
						</div>
						<ul class="tb-thumb" id="thumblist">
                            <li class="tb-selected">
                                <div class="tb-pic">
                                    <a>
                                        <img width="104" height="85" src="/static/images/mysql.jpg"
                                             mid="/static/images/mysql.jpg" big="/static/images/mysql.jpg">
                                    </a>
                                </div>
                            </li>
                            <li class="">
                                <div class="tb-pic">
                                    <a>
                                        <img width="104" height="85" src="/static/images/mysql.jpg"
                                             mid="/static/images/mysql.jpg" big="/static/images/mysql.jpg">
                                    </a>
                                </div>
                            </li>
                            <li class="">
                                <div class="tb-pic">
                                    <a>
                                        <img width="104" height="85" src="/static/images/mysql.jpg"
                                             mid="/static/images/mysql.jpg" big="/static/images/mysql.jpg">
                                    </a>
                                </div>
                            </li>
                            <li class="">
                                <div class="tb-pic">
                                    <a>
                                        <img width="104" height="85" src="/static/images/mysql.jpg"
                                             mid="/static/images/mysql.jpg" big="/static/images/mysql.jpg">
                                    </a>
                                </div>
                            </li>
						</ul>
					</div>
					<div class="des">
						<h1 title="django 从入门到精通体验开始了">{{ course.name }}</h1>
						<span class="key">{{ course.detail }}</span>
						<div class="prize">
							<span class="fl">价格：<i class="key">免费</i></span>
							<span class="fr">学习人数：{{ course.students }}</span>
						</div>
						<ul class="parameter">
							<li><span class="pram word3">时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;长：</span><span>{{ course.learn_times }}小时</span></li>
                            <li><span class="pram word3">课程难度：</span><span>{{ course.get_degree_display }}</span></li>
							<li><span class="pram word3">章节数量：</span><span title="">{{ course.get_zj_num }}</span></li>
                            <li><span class="pram word3">课程类别：</span><span title="">{{ course.category }}</span></li>
							<li class="piclist"><span class="pram word4">学习用户：</span>
								{% for user_course in course.get_course_user %}
									<span class="pic"><img width="40" height="40" src="{{ MEDIA_URL }}{{ user_course.user.image }}"/></span>
								{% endfor %}
							</li>
						</ul>
						<div class="btns">
							<div class="btn colectgroupbtn  notlogin 
                                  "data-favid="15" id="jsLeftBtn">
                                  {% if has_fav_course %}已收藏{% else %}收藏{% endif %}
                            </div>
                                <div class="buy btn"><a style="color: white" href="{% url 'course:course_info' course.id %}">开始学习</a></div>
						</div>
					</div>
                    <div class="group-share-box">
                        <div class="bdsharebuttonbox"
                             data-text="django开始了"
                             data-desc="我在#慕课网#发现了"
                             data-comment=""
                             data-url="/group/groupdetail/15/">
                            <span class="fl">分享到：</span>
                            <a href="#" class="bds_more" data-cmd="more"></a>
                            <a title="分享到QQ空间" href="#" class="bds_qzone" data-cmd="qzone"></a>
                            <a title="分享到新浪微博" href="#" class="bds_tsina" data-cmd="tsina"></a>
                            <a title="分享到腾讯微博" href="#" class="bds_tqq" data-cmd="tqq"></a>
                            <a title="分享到人人网" href="#" class="bds_renren" data-cmd="renren"></a>
                            <a title="分享到微信" href="#" class="bds_weixin" data-cmd="weixin"></a>
                        </div>
                    </div>
				</div>	
				<div class="right">
					<div class="head">
						<h1>授课机构</h1>
						<p>世界名校，课程权威</p>
					</div>
					<div class="pic">
                        <a href="{% url 'org:org_home' course.course_org.id %}">
                            <img width="150" height="80" src="{{ MEDIA_URL }}{{ course.course_org.image }}"/>
                        </a>
                    </div>
					<a href="{% url 'org:org_home' course.course_org.id %}">
                        <h2 class="center" title="org_name">{{ course.course_org.name }}</h2>
                    </a>
					<div class="btn  notlogin 
					     "data-favid="14" id="jsRightBtn">
                         {% if has_fav_org %}已收藏{% else %}收藏{% endif %}
                    </div>
					<div class="clear">
						<ul>
                            <li>
                                <span>课 &nbsp;程&nbsp; 数：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   {{ course.course_org.get_course_nums }}</span>
                            </li>
                            <li>
                                <span>教 &nbsp;师&nbsp; 数：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  {{ course.course_org.get_teacher_nums }}</span>
                            </li>
							<li>所在地区：&nbsp;&nbsp;{{ course.course_org.address }}</li>
							<li>认&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;证&nbsp;:
                                &nbsp;&nbsp;
								    <img title="金牌机构", src="/static/images/gold.png"/>
							</li>
						</ul>
					</div>
				</div>
			</div>
		</div>
	</div>
</section>
<section>
	<div class="wp">
		<div class="list groupPurchase_detail_pro">
			<div class="left layout">
				<div class="head">
					<ul class="tab_header">
						<li class="active">产品详细</li>      
					</ul>					  
				</div>
				<div class="tab_cont tab_cont1">
					{{ course.detail }}
					<!--<p><img src="/uploads/Entity/2016/06/blob_20160628155929_251.png" title="" alt="blob.png"/> </p><p><img src="/uploads/Entity/2016/06/blob_20160628155959_248.png" title="" alt="blob.png"/> </p><p><img src="/uploads/Entity/2016/06/blob_20160628160023_538.png" title="" alt="blob.png"/> </p><p><img src="/uploads/Entity/2016/06/blob_20160628160055_798.png" title="" alt="blob.png"/> </p><p><img src="/uploads/Entity/2016/06/blob_20160628160119_462.png" title="" alt="blob.png"/> </p>-->
				</div>
				<div class="tab_cont tab_cont2" >
					<div class="comment">
						<div class="comenlist">
                            
	                    </div>
					</div>
				</div>
			</div>
			<div class="right layout">
				<div class="head">相关课程推荐</div>
				 <div class="group_recommend">

                    {% for relate_course in relate_courses %}
                       <dl>
                            <dt>
                                <a target="_blank" href="{% url 'course:course_detail' relate_course.id %}">
                                    <img width="240" height="220" class="scrollLoading" src="{{ MEDIA_URL }}{{ relate_course.image }}"/>
                                </a>
                            </dt>
                            <dd>
                                <a target="_blank" href="{% url 'course:course_detail' relate_course.id %}"><h2>{{ relate_course.name }}</h2></a>
                                <span class="fl">学习时长：<i class="key">{{ relate_course.learn_times }}</i></span>
                            </dd>
                        </dl>
                    {% endfor %}

				</div>
			</div>
		</div>
	</div>
</section>
{% endblock %}

{% block custom_js %}
<script type="text/javascript">
//收藏分享
function add_fav(current_elem, fav_id, fav_type){
    $.ajax({
        cache: false,
        type: "POST",
        url:"{% url "org:add_fav" %}",
        data:{'fav_id':fav_id, 'fav_type':fav_type},
        async: true,
        beforeSend:function(xhr, settings){
            xhr.setRequestHeader("X-CSRFToken", "{{ csrf_token }}");
        },
        success: function(data) {
            if(data.status == 'fail'){
                if(data.msg == '用户未登录'){
                    window.location.href="{% url 'login' %}?next={{ request.path }}";
                }else{
                    alert(data.msg)
                }

            }else if(data.status == 'success'){
                current_elem.text(data.msg)
            }
        },
    });
}

$('#jsLeftBtn').on('click', function(){
    add_fav($(this), {{ course.id }}, 1);
});

$('#jsRightBtn').on('click', function(){
    add_fav($(this), {{ course.course_org.id }}, 2);
});


</script>
{% endblock %}

